<?php

/**
 * Inmobiliario form base class.
 *
 * @method Inmobiliario getObject() Returns the current form's model object
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseInmobiliarioForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                   => new sfWidgetFormInputHidden(),
      'adrema'               => new sfWidgetFormInputText(),
      'nro'                  => new sfWidgetFormInputText(),
      'mbk'                  => new sfWidgetFormInputText(),
      'piso'                 => new sfWidgetFormInputText(),
      'dpto'                 => new sfWidgetFormInputText(),
      'pavimentada'          => new sfWidgetFormChoice(array('choices' => array('SI' => 'SI', 'NO' => 'NO'))),
      'frente'               => new sfWidgetFormInputText(),
      'superficie'           => new sfWidgetFormInputText(),
      'superficie_edificada' => new sfWidgetFormInputText(),
      'valor_tierra'         => new sfWidgetFormInputText(),
      'valor_edificio'       => new sfWidgetFormInputText(),
      'contribuyente_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Contribuyente'), 'add_empty' => false)),
      'calle_id'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Calle'), 'add_empty' => true)),
      'barrio_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Barrio'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'id'                   => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'adrema'               => new sfValidatorString(array('max_length' => 40)),
      'nro'                  => new sfValidatorString(array('max_length' => 5, 'required' => false)),
      'mbk'                  => new sfValidatorString(array('max_length' => 5, 'required' => false)),
      'piso'                 => new sfValidatorString(array('max_length' => 5, 'required' => false)),
      'dpto'                 => new sfValidatorString(array('max_length' => 5, 'required' => false)),
      'pavimentada'          => new sfValidatorChoice(array('choices' => array(0 => 'SI', 1 => 'NO'), 'required' => false)),
      'frente'               => new sfValidatorNumber(array('required' => false)),
      'superficie'           => new sfValidatorNumber(array('required' => false)),
      'superficie_edificada' => new sfValidatorNumber(array('required' => false)),
      'valor_tierra'         => new sfValidatorNumber(array('required' => false)),
      'valor_edificio'       => new sfValidatorNumber(array('required' => false)),
      'contribuyente_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Contribuyente'))),
      'calle_id'             => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Calle'), 'required' => false)),
      'barrio_id'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Barrio'))),
    ));

    $this->widgetSchema->setNameFormat('inmobiliario[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Inmobiliario';
  }

}
